//
//  PlatformCell.m
//  reSearchDemo
//
//  Created by 云库 on 15/7/24.
//  Copyright (c) 2015年 Kiwaro. All rights reserved.
//

#import "PlatformCell.h"

#define kStatusTableViewCelltimerLabFontSize 14

@implementation PlatformCell

- (void)awakeFromNib {
    // Initialization code
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        userHeaderImg=[[UIImageView alloc]init];
        [self addSubview:userHeaderImg];
        userNameLab=[[UILabel alloc]init];
        [self addSubview:userNameLab];
        messgeLab=[[UILabel alloc]init];
        [self addSubview:messgeLab];
        timerLab=[[UILabel alloc] init];
        [self addSubview:timerLab];
    }
    return self;
}
-(void)setDataSourse:(NSDictionary *)dataSourse{

    userHeaderImg.frame=CGRectMake(5, 10, self.frame.size.height-20, self.frame.size.height-20);
    userHeaderImg.backgroundColor=[UIColor redColor];
    
    userNameLab.frame=CGRectMake(userHeaderImg.frame.size.width+5+15, CGRectGetMinY(userHeaderImg.frame), 40, 20);
    userNameLab.text=dataSourse[@"userName"];
    userNameLab.font=[UIFont systemFontOfSize:14];
    
    messgeLab.frame=CGRectMake(userNameLab.frame.origin.x, userNameLab.frame.origin.y+userNameLab.frame.size.height, 200, 20);
    messgeLab.text=dataSourse[@"context"];
    messgeLab.backgroundColor=[UIColor grayColor];
//    messgeLab.numberOfLines=0;
    messgeLab.font=[UIFont systemFontOfSize:14];

    CGSize size = [dataSourse[@"time"] sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kStatusTableViewCelltimerLabFontSize]}];
    timerLab.frame=CGRectMake(CGRectGetWidth(self.frame) - size.width - 10, CGRectGetMinY(userHeaderImg.frame), size.width, size.height);
    timerLab.font = [UIFont systemFontOfSize:kStatusTableViewCelltimerLabFontSize];

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
